package com.util.msn;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import rath.msnm.BuddyGroup;
import rath.msnm.BuddyList;
import rath.msnm.MSNMessenger;
import rath.msnm.UserStatus;
import rath.msnm.entity.MsnFriend;

public class MSNFriend {
	public List getMsnList(String number, String password) {
		
		MSNMessenger msn = new MSNMessenger(number, password);
		msn.setInitialStatus(UserStatus.ONLINE);
		msn.login();
		BuddyGroup group = msn.getBuddyGroup();
		BuddyList buddyList = group.getAllowList();

		List list = new ArrayList();
		String loginName = "";
		String name="";
		MsnFriend friend = null;
		try{
		for (Iterator it = buddyList.iterator(); it.hasNext();) {
			friend = (MsnFriend) it.next();
			loginName = friend.getLoginName();
			name=friend.getFriendlyName();
			
			//System.out.print("loginName22 = " + loginName+"==="+name+"\n");
			list.add(friend);

		}
		return list;
		}
		catch(Exception e ){
			
			e.printStackTrace();
			return list;
		}
	}
	
}
